﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace katOS
{
    class FCFS: AbstractQueue<Process>
    {

        public FCFS(int id, string name, int quantum, bool preemptive, int queueOnEnd, int queueOnIOEnd)
        {
            this.id = id;
            this.name = name;
            this.quantum = quantum;
            this.preemptive = preemptive;
            this.queueOnQuantumEnd = queueOnEnd;
            this.queueOnIOEnd = queueOnIOEnd;
        }

        public override Process getElement(int i)
        {
            return this.list.ElementAt(i);
        }

        public override Process getLastProcess()
        {
            return this.lastone_in;
        }

        public override Process getFirst()
        {
            return this.list.ElementAt(0);
        }

        public override void addProcess(Process new_process)
        {
            this.list.AddLast(new_process);
            this.lastone_in = new_process;
            this.lastone_in.setQuantumLeft(quantum);
            this.lastone_in.setState(2);
            this.lastone_in.io_wait = false;
        }

    }
}
